package com.baturu.vin.honda.dal.dao;

import com.baturu.vin.honda.dto.HondaBtrPartsDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * 本田配件信息查询DAO(适用于自编码)
 *
 * @author jiangxinlei
 */
public interface HondaPartsCarTypeDAO {

    @Select({"<script>" +
            "select distinct btrPartsName,partsCode from honda_self_parts_code " +
            "where btrId = #{btrId}" +
            "and btrPartsName in" +
            "<foreach item='btrPartsName' index='index' collection='btrPartsNames' open='(' separator=',' close=')'>" +
            "#{btrPartsName} " +
            "</foreach>" +
            "</script>"})
    Set<HondaBtrPartsDTO> oldWayToFindPartsCodes(@Param("btrId") String btrId, @Param("btrPartsNames") Set<String> btrPartsNames);

    @Select({"<script>" +
            "select distinct partsCode from honda_self_parts_code " +
            "where btrId = #{btrId}" +
            "and partsCode in" +
            "<foreach item='partsCode' index='index' collection='partsCodes' open='(' separator=',' close=')'>" +
            "#{partsCode} " +
            "</foreach>" +
            "</script>"})
    List<String> oldWayToFilterByPartsCodes(@Param("btrId") String btrId, @Param("partsCodes") Set<String> partsCodes);

    @Select({"<script>" +
            "select distinct partsCode from honda_self_parts_code " +
            "where partsCode in" +
            "<foreach item='item' index='index' collection='partsCodes' open='(' separator=',' close=')'>" +
            "#{item} " +
            "</foreach>" +
            "</script>"})
    List<String> querySelfPartsCodes(@Param("partsCodes") Set<String> partsCodes);

}
